<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="button" value="点击按钮修改图片属性" id="bn">
    <img src="img/cangjingkong.jpg" alt="苍老师" title="苍井空" id="im">
    <script>
    document.getElementById("bn").onclick = function (){
         var  im =  document.getElementById("im");
         im.alt = "修改";
         im.title = "嫁人了"
    }

    </script>
</body>
</html>